# 1.算数运算符
# + - * / // %

# a = 30
# b = 7
# print(a+b)
# print(a-b)
# print(a*b)
# print(a/b)  #浮点数
# print(a//b) #商
# print(a%b)  #余数

# 2.关系运算符（比较运算符）
# > < >= <= != ==
# 运算的结果为bool类型

# a = 30
# b = 20
# print(a>b)
# print(a<b)
# print(a>=b)
# print(a<=b)
# print(a!=b)
# print(a==b)

# 3. 逻辑运算符
# and 与
# or 或
# not 取反

# rich = False
# handsome = True
# print(rich and handsome)

# print(True and True)
# print(True and False)
# print(False and False)

# 4.赋值运算符
# （左边必须是一个变量）（右边是一个表达式）
# 表达式：由常量、运算符、变量构成的式子
# 会先计算右侧表达式的值，然后存入到左侧的变量中
# =
# += -= *= /= //= %=

# a = 100
# b = 100 * 100
# c = a+b*3

# a = 10
# a = a + 1
# # =>
# a += 1
# print(a)

# Traceback (most recent call last):
#   File "D:/pythoncode/01-基础/5-运算符.py", line 58, in <module>
#     a = a + 1
# NameError: name 'a' is not defined

# 位运算符
# 二进制进行位操作
# & 与
# | 或
# ^ 异或
# ~ 取反
# << 向左位移 右边补0
# >> 向右位移 左边根据符号位补 正数 补0 负数 补1

a = 60
b = 13

print("a&b = %d" % (a & b))
print("a&b = %d" % (a | b))
print("a&b = %d" % (a ^ b))
print("a = %d" % (~a))

print(60<<2)
print(60>>1)
